package com.ruoyi.finance.collection.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.Data;
import org.apache.ibatis.type.JdbcType;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 收款费项表
 * @TableName BILL_COLLECTION
 */
@TableName(value ="BILL_COLLECTION")
@Data
@KeySequence(value = "SEQ_BILL_COLLECTION")
public class BillCollection  extends BaseEntity implements Serializable{
    /**
     * ID
     */
    @TableId(value = "BILL_COLLECTION_ID",type = IdType.INPUT)
    private Long billCollectionId;

    /**
     * 订单ID
     */
    @TableField(value = "PROJECT_ID")
    private Long projectId;

    /**
     * 项目ID，指gkey，如：D128B0E196655D82E0539621C50A41CD
     */
    @TableField(value = "GKEY")
    private String gkey;

    /**
     * 合同id
     */
    @TableField(value = "CON_ID")
    private Long conId;

    /**
     * 费目id
     */
    @TableField(value = "BASIC_FEE_CODE")
    private String basicFeeCode;

    /**
     * 费目
     */
    @TableField(value = "BASIC_FEE_NAME")
    private String basicFeeName;

    /**
     * 单价
     */
    @TableField(value = "UNIT_PRICE")
    private BigDecimal unitPrice;

    /**
     * 数量
     */
    @TableField(value = "WORK_NUM")
    private BigDecimal workNum;

    /**
     * 金额(含税)
     */
    @TableField(value = "AMOUNT")
    private BigDecimal amount;

    /**
     * 币种
     */
    @TableField(value = "CURRENCY")
    private String currency;


    /**
     * 对账单id
     */
    @TableField(value = "STATEMENT_ID")
    private Long statementId;


    /**
     * 删除标志，0未删除  2删除
     */
    @TableLogic(value = "0", delval = "2")
    private String delFlag;

    /**
     * 备注
     */
    @TableField(value = "REMARK")
    private String remark;

    /**
     * 删除人
     */
    @TableField(value = "DEL_NAME")
    private String delName;

    /**
     * 删除时间
     */
    @TableField(value = "DEL_TIME")
    private Date delTime;

    /**
     * 二级费目id
     */
    @TableField(value = "FEE_SERVICE_ID")
    private Long feeServiceId;

    /**
     * 二级费目名称
     */
    @TableField(value = "FEE_SERVICE_NAME")
    private String feeServiceName;


    /**
     * 单位
     */
    @TableField(value = "UNIT")
    private String unit;

    /**
     * 委托方ID
     */
    @TableField(value = "CUSTOMER_COD")
    private String customerCod;


    /**
     * 收款来源，0新增 1代收代付 2计费引擎 3手动修改
     */
    @TableField(value = "COLLECTION_SOURCE")
    private String collectionSource;

    /**
     * 计费要素，如天数等
     */
    @TableField(value = "WORK_NUM_B")
    private BigDecimal workNumB;

    /**
     * 费项id
     */
    @TableField(value = "RULE_ID")
    private Long ruleId;

    /**
     * 汇率，如：美元兑人民币
     */
    @TableField(value = "EXCHANGE_RATE")
    private BigDecimal exchangeRate;

    /**
     * 换算金额
     */
    @TableField(value = "EXCHANGE_AMOUNT")
    private BigDecimal exchangeAmount;

    @TableField(value = "COLLECTION_STATUS")
    private String collectionStatus;

    private String customerNam;

//    @TableField(fill = FieldFill.INSERT)
    // 用fill = FieldFill.INSERT注解companyCod时，会去读取系统当前登录用户的companyCod并注入，在并行操作时容易报错，而且也不符合实际业务逻辑
    @TableField(value = "COMPANY_COD")
    private String companyCod;

    private BigDecimal taxRate;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;
}